package bongo.framework.gameobject.component;

import java.io.Serializable;

import bongo.framework.annotations.Paintable;
import bongo.framework.annotations.Updatable;
import bongo.framework.gameobject.GameObject;
/**
 * The Component Interface
 * 
 * @author boogie
 *
 */
public interface Component extends Cloneable,Serializable{
	/**
	 * 
	 * @param g - the parent {@link GameObject} of the Component
	 */
	public void setGameObject(GameObject g);
	/**
	 * 
	 * @return the parent {@link GameObject} of this Component
	 */
	public GameObject gameObject();
	/**
	 * <p>Used for cloning a Component upon its being added to a GameObject</p>
	 * <p>It is automatically called when this component is added to a GameObject make sure not return null here</p>
	 * <pre>
	 * {@code}
	 * The most basic implementation of this is:
	 * 
	 * public Component cloneForGameObject(){
	 * 	return new SomeComponent();//assuming that the current class is SomeComponent
	 * }
	 * 
	 * </pre>
	 * @param g the GameObject parent of this component
	 * @return a clone of this component 
	 */
	public Component cloneForGameObject(GameObject g);
	/**
	 * Called on Component initialization.
	 * Use for in this method you can setup the dependencies of this Component
	 * to get a reference to other Components use gameObject().getComponent method
	 */
	public void init();
	
	/**
	 * Called on destruction of the parent {@link GameObject}
	 * Use for Component Cleanup
	 */
	public void destroy();
	
	/**
	 * Updates the component IF ITS ANNOTATED WITH THE {@link Updatable} Annotation
	 * @param delta
	 */
	public void update(float delta);
	
	/**
	 * Paints the component IF ITS ANNOTATED WITH THE {@link Paintable} Annotation
	 * @param alpha
	 */
	public void paint(float alpha);
	
	
}
